<?php
namespace Home\Model;
use Think\Model;

class UserToTemplateModel extends BaseModel {

	protected $tableName = 'tp_user_to_template';

	/**
	 * @desc: 根据用户ID查询默认短信模板
	 * @Author: delayhsiao
	 * @update: 2016-11-26
	 **/
	public function getDefaultTemp($userId){
		$templateId = $this->where(array('f_user_id'=>$userId))->getField('f_template_id');
		return $templateId;
	}

	/**
	 * @desc: 根据短信模板ID删除默认模板设置
	 * @Author: delayhsiao
	 * @update: 2016-11-26
	 **/
	public function removeDefaultTemp($templateId){
		$result = $this->where(array('f_template_id'=>$templateId))->delete();
		if($result){
			return true;
		}else{
			return false;
		}
	}

}